<html>
<head>
  <title>用户管理——用户列表</title>
  <meta name="layout" content="common_header"/>
  <script type="text/javascript" src="${resource(dir: 'js/jquery', file: 'jquery.form.min.js', absolute: true)}"></script>
  <script type="text/javascript" src="${resource(dir: 'js/jquery', file: 'jquery.metadata.pack.js', absolute: true)}"></script>
  <script type="text/javascript" src="${resource(dir: 'js/jquery', file: 'common.custom.js', absolute: true)}"></script>
  <script type="text/javascript">
    jQuery(document).ready(function() {
      if ($("#bidDate").val() != '') {
        $("#bidCount").html("${list.count}");
      } else {
        var today = new Date();
        $("#bidDate").val(today.getYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate());
      }
    });
    function agentCheck(id, falg) {
      jQuery.post("${createLink(controller:'scaffold',action:'save',absolute:true)}", {property:'User',id:id,stateFlag:falg ? "20" : "40"}, function(response) {
        if (response == '1') {
          var state = "<a href=\"${createLink(controller:'user',action:'businessShow',absolute:true)}?id=" + id + "\">" + "经纪人</a>";
          if (!falg) {
            state = '经纪人申请失败';
          }
          $("#state_" + id).html(state);
        }
      });
    }

  </script>
</head>
<body>
<div id="man_zone">
  <form id="submitForm" name="submitForm" action="${createLink(controller: "admin", action: 'approveEstate', absolute: true)}" method="post">
    <input type="hidden" id="id" name="id"/>
    <input type="hidden" id="flag" name="flag"/>
  </form>

  <input type="hidden" name="property" value="${params?.property}"/>
  <form id="queryForm" name="queryForm" action="${createLink(controller: "scaffold", action: 'list', absolute: true)}" method="post">
    <input type="hidden" name="property" value="${params?.property}"/>
    <table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" class="table_style">
      <tr>
        <td class="left_title_1">姓名:</td>
        <td>
          <input type="text" id="zlk_name" name="zlk_name" value="${params?.zlk_name}">
        </td>
        <td class="left_title_1">日期:</td>
        <td>
          <input type="text" id="zlk_dateCreated" name="zlk_dateCreated" value="${params?.zlk_dateCreated}">
        </td>
      </tr>
      <tr>
        <td class="left_title_1">状态:</td>
        <td>
          <g:radioGroup name="zlk_stateFlag" labels="['普通','经纪人','申请经纪人','申请失败']" value="${params?.zlk_stateFlag}" values="['10','20','30','40']">
            ${it.label} ${it.radio} &nbsp;
          </g:radioGroup>
        </td>
        <td class="left_title_1"></td>
        <td>

        </td>
      </tr>

      <tr><td align="center" colspan="2">
        <input type="image" src="${resource(dir: '/images/admin_ui/', file: 'query1.gif', absolute: true)}" alt="查询"/>
      </td></tr>
    </table>
  </form>
  <form id="bidUser" name="bidUser" action="${createLink(controller: "user", action: 'bidUser', absolute: true)}" method="post">
    <input type="hidden" name="property" value="${params?.property}"/>
    日期：<input id="bidDate" type="text" name="date" value="${date}">
    <input type="submit" value="竞标查询"></input>  竞标人数：<span id="bidCount">0</span>人
  </form>
  <br>
  <table cellpadding="0" cellspacing="0" width="95%" align="center" class="xtable">
    <thead>
    <tr>
      <g:sortableColumn action="list" property="name" title="姓名" params="${params}" action="${createLink(controller:"scaffold",action:'list',absolute:true)}"/>
      <th>信息总数</th>
      <th>可竞标信息数</th>
      <th>账户积分</th>
      <th>账户点卷</th>
      <th>入库照片数</th>
      <th>楼盘添加数</th>
      <th>邀请人数</th>
      <th>登陆次数</th>
      <th>状态</th>
      <th>日期</th>
    </tr>
    </thead>
    <tbody>
    <g:each in="${list.items}">
      <tr>
        <td width="10%" align="center"><a href="${createLink(controller: 'scaffold', action: 'show', absolute: true)}?property=User&id=${it.id}">${it.name}</a></td>
        <td width="10%" align="center">${it.infoCount}</td>
        <td width="10%" align="center">${it.bidCount}</td>
        <td width="10%" align="center">${it.availablePoint}</td>
        <td width="10%" align="center">${it.availableCoupon}</td>
        <td width="10%" align="center">${it.acceptPicCount}</td>
        <td width="10%" align="center">${it.estateCount}</td>
        <td width="10%" align="center">0</td>
        <td width="10%" align="center">0</td>
        <td width="10%" align="center" id="state_${it.id}">
          <g:if test="${it.state==it.STATE_AGENT}"><a href="${createLink(controller: 'user', action: 'businessShow', absolute: true)}?id=${it.id}">经纪人</a></g:if>
          <g:elseif test="${it.state==it.STATE_AGENT_APPLY}"><a href="javascript:agentCheck('${it.id}',true)">通过</a>|<a href="javascript:agentCheck('${it.id}',false)">不通过</a></g:elseif>
          <g:elseif test="${it.state==it.STATE_AGENT_APPLY_FAIL}">经纪人申请失败</g:elseif>
          <g:else>普通用户</g:else>
        </td>
        <td width="10%" align="center"><g:formatDate format="yyyy-MM-dd" date="${it.dateCreated}"/></td>
      </tr>
    </g:each>
    </tbody>
    <tfoot>
    <tr>
      <td colspan="10" align="center">
        <g:paginate total="${list.count}" params="${params}"/>
      </td>
    </tr>
    </tfoot>
  </table>
</div>
</body>
</html>
